package com.gzcstec.dao;

import com.gzcstec.domain.Host;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 站点dao表
 */
@Mapper
@Repository
public interface HostDao {

    @Select("select host_id,return_url,state,email from host where host_id = #{hostId}")
    Host getById(@Param("hostId")String hostId);

    @Select("select host_id,return_url,state,email from host where state = #{state}")
    Host getByState(@Param("state")String state);

    @Insert("insert into host(host_id,return_url,state,email) values (#{hostId},#{returnUrl},#{state},#{email})")
    int addHost(Host host);

    @Select("select host_id,return_url,state,email from host")
    List<Host> getList();

    @Update("update host set return_url=#{returnUrl},email=#{email} where host_id=#{hostId}")
    int updateHost(Host host);

    @Delete("delete from host where host_id = #{hostId}")
    int deleteHost(@Param("hostId")String hostId);

}
